Socket
Socket
Sign inDemoInstall

extglob

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    extglob

Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.


Version published
Maintainers
1
Install size
14.8 kB
Created

Readme

Source

extglob NPM version Build Status

Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.

Install with npm

$ npm i extglob --save

Used by micromatch.

Features

  • Convert an extglob string to a regex-compatible string. Only converts extglobs, to handle full globs use micromatch.
  • Pass {regex: true} to return a regex
  • Handles nested patterns
  • More complete (and correct) support than minimatch

Usage

var extglob = require('extglob');

extglob('?(z)');
//=> '(?:z)?'
extglob('*(z)');
//=> '(?:z)*'
extglob('+(z)');
//=> '(?:z)+'
extglob('@(z)');
//=> '(?:z)'
extglob('!(z)');
//=> '(?!^(?:(?!z)[^/]*?)).*$'

Optionally return regex

extglob('!(z)', {regex: true});
//=> /(?!^(?:(?!z)[^/]*?)).*$/

Extglob patterns

To learn more about how extglobs work, see the docs for Bash pattern matching:

  • ?(pattern): Match zero or one occurrence of the given pattern.
  • *(pattern): Match zero or more occurrences of the given pattern.
  • +(pattern): Match one or more occurrences of the given pattern.
  • @(pattern): Match one of the given pattern.
  • !(pattern): Match anything except one of the given pattern.
  • braces: Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… more
  • expand-brackets: Expand POSIX bracket expressions (character classes) in glob patterns.
  • expand-range: Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… more
  • fill-range: Fill in a range of numbers or letters, optionally passing an increment or multiplier to… more
  • micromatch: Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… more

Run tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on August 01, 2015.

Keywords

FAQs

Last updated on 20 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc